home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v8n13.arc / SUBST.BAS < prev    next >
BASIC Source File  |  1989-06-10  |  355b  |  14 lines

  1. SUB SUBST (old$, new$, text$, start)
  2.     gap = LEN(old$)
  3.     n = LEN(text$)
  4.     IF start <= n THEN
  5.        x = INSTR(start, text$, old$)
  6.        DO WHILE x > 0
  7.           text$ = LEFT$(text$, x - 1) + new$ +_
  8.             RIGHT$(text$, n + 1 -(x + gap))
  9.           n = LEN(text$)
  10.           x = INSTR(x, text$, old$)
  11.        LOOP
  12.     END IF
  13. END SUB
  14.